//
//  OperationBillListCell.m
//  LogisticsSupplier
//
//  Created by 吕晶 on 2020/11/9.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "OperationBillListCell.h"

@interface OperationBillListCell ()

@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UIView *addressBgView;
@property (nonatomic, strong) UILabel *fromAddLab;
@property (nonatomic, strong) UIImageView *statusImgView;
@property (nonatomic, strong) UILabel *statusLab;
@property (nonatomic, strong) UILabel *toAddLab;

@property (nonatomic, strong) UILabel *goodTitleLab;
@property (nonatomic, strong) UILabel *goodLab;
@property (nonatomic, strong) UILabel *packageTitleLab;
@property (nonatomic, strong) UILabel *packageLab;
@property (nonatomic, strong) UILabel *jieTitleLab;
@property (nonatomic, strong) UILabel *jieLab;
@property (nonatomic, strong) UILabel *jiaoTitleLab;
@property (nonatomic, strong) UILabel *jiaoLab;
@property (nonatomic, strong) UILabel *timeTitleLab;
@property (nonatomic, strong) UILabel *timeLab;

@property (nonatomic, strong) UILabel *line1;
@property (nonatomic, strong) UILabel *line2;
@property (nonatomic, strong) UILabel *line3;
@property (nonatomic, strong) UIButton *btn1;
@property (nonatomic, strong) UIButton *btn2;
@property (nonatomic, strong) UIButton *btn3;

@end

@implementation OperationBillListCell

+ (instancetype)OperationBillListCellWithTableView:(UITableView *)tableView {
    static NSString *cellID = @"OperationBillListCell";
    OperationBillListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[OperationBillListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = Color_backgroundColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.bgView = [UIView new];
        self.bgView.backgroundColor = HexColor(0xffffff);
        self.bgView.layer.masksToBounds = YES;
        self.bgView.layer.cornerRadius = 6;
        [self.contentView addSubview:self.bgView];
        
        self.addressBgView = [UIView new];
        self.addressBgView.backgroundColor = HexColor(0xF7F7FA);
        self.addressBgView.layer.masksToBounds = YES;
        self.addressBgView.layer.cornerRadius = 2;
        [self.bgView addSubview:self.addressBgView];
        
        self.fromAddLab = [UILabel new];
        self.fromAddLab.textColor = HexColor(0x2B2C44);
        self.fromAddLab.font = BoldFontOfSize(20);
        self.fromAddLab.textAlignment = NSTextAlignmentCenter;
        [self.addressBgView addSubview:self.fromAddLab];
        
        self.statusImgView = [UIImageView new];
        [self.addressBgView addSubview:self.statusImgView];
        
        self.statusLab = [UILabel new];
        self.statusLab.textColor = Color_ThemeColor;
        self.statusLab.font = BoldFontOfSize(12);
        [self.addressBgView addSubview:self.statusLab];
        
        self.toAddLab = [UILabel new];
        self.toAddLab.textColor = HexColor(0x2B2C44);
        self.toAddLab.font = BoldFontOfSize(20);
        self.toAddLab.textAlignment = NSTextAlignmentCenter;
        [self.addressBgView addSubview:self.toAddLab];
        
        self.goodTitleLab = [UILabel new];
        self.goodTitleLab.textColor = HexColor(0x9C9DB3);
        self.goodTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.goodTitleLab];
        
        self.goodLab = [UILabel new];
        self.goodLab.textColor = HexColor(0x2B2C44);
        self.goodLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.goodLab];
        
        self.packageTitleLab = [UILabel new];
        self.packageTitleLab.textColor = HexColor(0x9C9DB3);
        self.packageTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.packageTitleLab];
        
        self.packageLab = [UILabel new];
        self.packageLab.textColor = HexColor(0x2B2C44);
        self.packageLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.packageLab];
        
        self.jieTitleLab = [UILabel new];
        self.jieTitleLab.textColor = HexColor(0x9C9DB3);
        self.jieTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.jieTitleLab];
        
        self.jieLab = [UILabel new];
        self.jieLab.textColor = HexColor(0x2B2C44);
        self.jieLab.font = [UIFont systemFontOfSize:14];
        self.jieLab.numberOfLines = 0;
        [self.bgView addSubview:self.jieLab];
        
        self.jiaoTitleLab = [UILabel new];
        self.jiaoTitleLab.textColor = HexColor(0x9C9DB3);
        self.jiaoTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.jiaoTitleLab];
        
        self.jiaoLab = [UILabel new];
        self.jiaoLab.textColor = HexColor(0x2B2C44);
        self.jiaoLab.font = [UIFont systemFontOfSize:14];
        self.jiaoLab.numberOfLines = 0;
        [self.bgView addSubview:self.jiaoLab];
        
        self.timeTitleLab = [UILabel new];
        self.timeTitleLab.textColor = HexColor(0x9C9DB3);
        self.timeTitleLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.timeTitleLab];
        
        self.timeLab = [UILabel new];
        self.timeLab.textColor = HexColor(0x2B2C44);
        self.timeLab.font = [UIFont systemFontOfSize:14];
        [self.bgView addSubview:self.timeLab];
        
        self.line1 = [UILabel new];
        self.line1.backgroundColor = Color_backgroundColor;
        [self.bgView addSubview:self.line1];
        
        self.line2 = [UILabel new];
        self.line2.backgroundColor = Color_backgroundColor;
        [self.bgView addSubview:self.line2];
        
        self.line3 = [UILabel new];
        self.line3.backgroundColor = Color_backgroundColor;
        [self.bgView addSubview:self.line3];
        
        self.btn1 = [UIButton new];
        self.btn1.layer.masksToBounds = YES;
        [self.bgView addSubview:self.btn1];
        
        self.btn2 = [UIButton new];
        self.btn2.layer.masksToBounds = YES;
        [self.bgView addSubview:self.btn2];
        
        self.btn3 = [UIButton new];
        self.btn3.layer.masksToBounds = YES;
        [self.bgView addSubview:self.btn3];
        
    }
    return self;
}

- (void)setModel:(OperationBillMainModel *)model {
    _model = model;
    [self configUI];
}

- (void)configUI {
    self.bgView.nim_left = 15;
    self.bgView.nim_top = 10;
    self.bgView.nim_width = ScreenW - 30;
    
    self.addressBgView.frame = CGRectMake(10, 10, self.bgView.nim_width - 2 * 10, 69);
    
    self.statusImgView.nim_width = 59;
    self.statusImgView.nim_height = 10;
    self.statusImgView.nim_left = (self.addressBgView.nim_width - self.statusImgView.nim_width) * 0.5;
    self.statusImgView.nim_top = 27;
    [self.statusImgView setImage:[UIImage imageNamed:@"operationbill_status"]];
    
    if (self.model.s_type == 1) {
        self.statusLab.text = @"提货";
    }else if (self.model.s_type == 2) {
        self.statusLab.text = @"干线";
    }else if (self.model.s_type == 3) {
        self.statusLab.text = @"派送";
    }else if (self.model.s_type == 4) {
        self.statusLab.text = @"交货";
    }else {
        self.statusLab.text = @"其他";
    }
    [self.statusLab sizeToFit];
    self.statusLab.nim_centerX = self.statusImgView.nim_centerX;
    self.statusLab.nim_top = self.statusImgView.nim_bottom + 5;
    
    self.fromAddLab.nim_left = 10;
    self.fromAddLab.text = self.model.start_city;
    [self.fromAddLab sizeToFit];
    self.fromAddLab.nim_width = self.statusImgView.nim_left - 20;
    self.fromAddLab.nim_centerY = self.statusImgView.nim_centerY;
    
    self.toAddLab.nim_left = 10 + self.statusImgView.nim_right;
    self.toAddLab.text = self.model.end_city;
    [self.toAddLab sizeToFit];
    self.toAddLab.nim_width = self.statusImgView.nim_left - 20;
    self.toAddLab.nim_centerY = self.statusImgView.nim_centerY;
    
    self.goodTitleLab.text = @"货物信息：";
    [self.goodTitleLab sizeToFit];
    self.goodTitleLab.nim_left = 10;
    self.goodTitleLab.nim_top = self.addressBgView.nim_bottom + 10;
    
    self.goodLab.nim_left = self.goodTitleLab.nim_right;
    self.goodLab.nim_top = self.goodTitleLab.nim_top;
    self.goodLab.nim_width = self.bgView.nim_width - 10 - self.goodTitleLab.nim_right;
    self.goodLab.nim_height = self.goodTitleLab.nim_height;
    self.goodLab.text = [NSString stringWithFormat:@"%@件；%@kg；%@m³；",self.model.goods_jnum,self.model.total_weight,self.model.total_volume];
    
    self.packageTitleLab.text = @"包装类型：";
    [self.packageTitleLab sizeToFit];
    self.packageTitleLab.nim_left = 10;
    self.packageTitleLab.nim_top = self.goodTitleLab.nim_bottom + 5;
    
    self.packageLab.nim_left = self.packageTitleLab.nim_right;
    self.packageLab.nim_top = self.packageTitleLab.nim_top;
    self.packageLab.nim_width = self.bgView.nim_width - 10 - self.packageTitleLab.nim_right;
    self.packageLab.nim_height = self.packageTitleLab.nim_height;
    self.packageLab.text = self.model.pk_name;
    
    self.jieTitleLab.text = @"接货地址：";
    [self.jieTitleLab sizeToFit];
    self.jieTitleLab.nim_left = 10;
    self.jieTitleLab.nim_top = self.packageTitleLab.nim_bottom + 5;
    
    self.jieLab.nim_left = self.jieTitleLab.nim_right;
    self.jieLab.nim_top = self.jieTitleLab.nim_top;
    self.jieLab.nim_width = self.bgView.nim_width - 10 - self.jieTitleLab.nim_right;
    self.jieLab.text = self.model.pickup_address;
    [self.jieLab sizeToFit];
    self.jieLab.nim_width = self.bgView.nim_width - 10 - self.jieTitleLab.nim_right;
    if (!self.model.pickup_address.length) {
        self.jieLab.nim_height = self.jieTitleLab.nim_height;
    }
    
    self.jiaoTitleLab.text = @"交货地址：";
    [self.jiaoTitleLab sizeToFit];
    self.jiaoTitleLab.nim_left = 10;
    self.jiaoTitleLab.nim_top = self.jieLab.nim_bottom + 5;
    
    self.jiaoLab.nim_left = self.jiaoTitleLab.nim_right;
    self.jiaoLab.nim_top = self.jiaoTitleLab.nim_top;
    self.jiaoLab.nim_width = self.bgView.nim_width - 10 - self.jiaoTitleLab.nim_right;
    self.jiaoLab.text = self.model.delivery_address;
    [self.jiaoLab sizeToFit];
    self.jiaoLab.nim_width = self.bgView.nim_width - 10 - self.jiaoTitleLab.nim_right;
    if (!self.model.delivery_address.length) {
        self.jiaoLab.nim_height = self.jiaoTitleLab.nim_height;
    }
    
    self.timeTitleLab.text = @"要求到达时间：";
    [self.timeTitleLab sizeToFit];
    self.timeTitleLab.nim_left = 10;
    self.timeTitleLab.nim_top = self.jiaoLab.nim_bottom + 5;
    
    self.timeLab.nim_left = self.timeTitleLab.nim_right;
    self.timeLab.nim_top = self.timeTitleLab.nim_top;
    self.timeLab.nim_width = self.bgView.nim_width - 10 - self.timeTitleLab.nim_right;
    self.timeLab.nim_height = self.timeTitleLab.nim_height;
    self.timeLab.text = self.model.arrival_time;
    
    self.line1.frame = CGRectMake(0, self.timeTitleLab.nim_bottom + 15, self.bgView.nim_width, 1);
    
    CGFloat marginW = (self.bgView.nim_width - 2) * 0.33333;
    CGFloat btn2W = 102;
    CGFloat btn3W = 60;
    CGFloat btnH = 30;
    [self.btn1 addTarget:self action:@selector(detailClick) forControlEvents:UIControlEventTouchUpInside];
    [self.btn2 addTarget:self action:@selector(btn2Click) forControlEvents:UIControlEventTouchUpInside];
    [self.btn3 addTarget:self action:@selector(btn3Click) forControlEvents:UIControlEventTouchUpInside];
    if (self.model.billStatus) {
        //完成
        self.line2.frame = CGRectMake((self.bgView.nim_width - 1) * 0.5, self.line1.nim_bottom, 1, 42);
        self.line3.frame = CGRectZero;
        
        self.btn1.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5, self.line1.nim_bottom + 6, btn2W, btnH);
        [self.btn1 setBackgroundColor:HexColor(0xffffff)];
        [self.btn1 setTitle:@"详情" forState:0];
        [self.btn1 setTitleColor:Color_ThemeColor forState:0];
        self.btn1.titleLabel.font = BoldFontOfSize(14);
        
        self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
        [self.btn2 setBackgroundColor:HexColor(0xffffff)];
        [self.btn2 setTitle:@"查看二维码" forState:0];
        [self.btn2 setTitleColor:Color_ThemeColor forState:0];
        self.btn2.titleLabel.font = BoldFontOfSize(14);
        
        self.btn3.frame = CGRectZero;
    }else {
        if (self.model.s_status == 1) {
            //受理
            self.line2.frame = CGRectMake(marginW, self.line1.nim_bottom, 1, 42);
            self.line3.frame = CGRectMake(self.bgView.nim_width - marginW - 1, self.line1.nim_bottom, 1, 42);
            self.btn1.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn1 setBackgroundColor:HexColor(0xffffff)];
            [self.btn1 setTitle:@"详情" forState:0];
            [self.btn1 setTitleColor:Color_ThemeColor forState:0];
            self.btn1.titleLabel.font = BoldFontOfSize(14);
            
            self.btn2.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn2 setBackgroundColor:HexColor(0xF35959)];
            [self.btn2 setTitle:@"驳回" forState:0];
            [self.btn2 setTitleColor:HexColor(0xffffff) forState:0];
            self.btn2.titleLabel.font = BoldFontOfSize(14);
            self.btn2.layer.cornerRadius = btnH * 0.5;
            
            self.btn3.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5 + self.line3.nim_right, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn3 setBackgroundColor:Color_ThemeColor];
            [self.btn3 setTitle:@"受理" forState:0];
            [self.btn3 setTitleColor:HexColor(0xffffff) forState:0];
            self.btn3.titleLabel.font = BoldFontOfSize(14);
            self.btn3.layer.cornerRadius = btnH * 0.5;
            self.btn3.userInteractionEnabled = YES;
            
        }else if (self.model.s_status == 2) {
            //驳回
            self.line2.frame = CGRectMake((self.bgView.nim_width - 1) * 0.5, self.line1.nim_bottom, 1, 42);
            self.line3.frame = CGRectZero;

            self.btn1.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn1 setBackgroundColor:HexColor(0xffffff)];
            [self.btn1 setTitle:@"详情" forState:0];
            [self.btn1 setTitleColor:Color_ThemeColor forState:0];
            self.btn1.titleLabel.font = BoldFontOfSize(14);
            
            self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn2 setBackgroundColor:HexColorA(0xF35959, 0.1)];
            [self.btn2 setTitle:@"供应商驳回" forState:0];
            [self.btn2 setTitleColor:HexColor(0xF35959) forState:0];
            self.btn2.titleLabel.font = BoldFontOfSize(14);
            self.btn2.layer.cornerRadius = btnH * 0.5;
            
            self.btn3.frame = CGRectZero;
        }else if (self.model.s_status == 3) {
            //收货
            self.line2.frame = CGRectMake(marginW, self.line1.nim_bottom, 1, 42);
            self.line3.frame = CGRectMake(self.bgView.nim_width - marginW - 1, self.line1.nim_bottom, 1, 42);
            
            self.btn1.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn1 setBackgroundColor:HexColor(0xffffff)];
            [self.btn1 setTitle:@"详情" forState:0];
            [self.btn1 setTitleColor:Color_ThemeColor forState:0];
            self.btn1.titleLabel.font = BoldFontOfSize(14);
            
            self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn2 setBackgroundColor:HexColor(0xffffff)];
            [self.btn2 setTitle:@"查看二维码" forState:0];
            [self.btn2 setTitleColor:Color_ThemeColor forState:0];
            self.btn2.titleLabel.font = BoldFontOfSize(14);
            
            self.btn3.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5 + self.line3.nim_right, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn3 setTitle:@"收货" forState:0];
            [self.btn3 setTitleColor:HexColor(0xffffff) forState:0];
            self.btn3.titleLabel.font = BoldFontOfSize(14);
            self.btn3.layer.cornerRadius = btnH * 0.5;
            if (self.model.show_button == 1) {
                [self.btn3 setBackgroundColor:[UIColor lightGrayColor]];
                self.btn3.userInteractionEnabled = NO;
            }else {
                [self.btn3 setBackgroundColor:Color_ThemeColor];
                self.btn3.userInteractionEnabled = YES;
            }
        }else if (self.model.s_status == 4) {
            //调度
            self.line2.frame = CGRectMake(marginW, self.line1.nim_bottom, 1, 42);
            self.line3.frame = CGRectMake(self.bgView.nim_width - marginW - 1, self.line1.nim_bottom, 1, 42);
            
            self.btn1.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn1 setBackgroundColor:HexColor(0xffffff)];
            [self.btn1 setTitle:@"详情" forState:0];
            [self.btn1 setTitleColor:Color_ThemeColor forState:0];
            self.btn1.titleLabel.font = BoldFontOfSize(14);
            
            if (self.model.is_d_reject == 1) {
                self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
                [self.btn2 setBackgroundColor:HexColorA(0xF35959, 0.1)];
                [self.btn2 setTitle:@"司机驳回" forState:0];
                [self.btn2 setTitleColor:HexColor(0xF35959) forState:0];
                self.btn2.titleLabel.font = BoldFontOfSize(14);
                self.btn2.layer.cornerRadius = btnH * 0.5;
            }else {
                self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
                [self.btn2 setBackgroundColor:HexColor(0xffffff)];
                [self.btn2 setTitle:@"查看二维码" forState:0];
                [self.btn2 setTitleColor:Color_ThemeColor forState:0];
                self.btn2.titleLabel.font = BoldFontOfSize(14);
            }
            
            self.btn3.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5 + self.line3.nim_right, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn3 setBackgroundColor:Color_ThemeColor];
            [self.btn3 setTitle:@"调度" forState:0];
            [self.btn3 setTitleColor:HexColor(0xffffff) forState:0];
            self.btn3.titleLabel.font = BoldFontOfSize(14);
            self.btn3.layer.cornerRadius = btnH * 0.5;
    //        if (self.model.show_button == 1) {
    //            [self.btn3 setBackgroundColor:[UIColor lightGrayColor]];
    //            self.btn3.userInteractionEnabled = NO;
    //        }else {
    //            [self.btn3 setBackgroundColor:Color_ThemeColor];
    //            self.btn3.userInteractionEnabled = YES;
    //        }
        }else if (self.model.s_status == 5) {
            //途中
            self.line2.frame = CGRectMake(marginW, self.line1.nim_bottom, 1, 42);
            self.line3.frame = CGRectMake(self.bgView.nim_width - marginW - 1, self.line1.nim_bottom, 1, 42);
            
            self.btn1.frame = CGRectMake((self.line2.nim_left - btn3W) * 0.5, self.line1.nim_bottom + 6, btn3W, btnH);
            [self.btn1 setBackgroundColor:HexColor(0xffffff)];
            [self.btn1 setTitle:@"详情" forState:0];
            [self.btn1 setTitleColor:Color_ThemeColor forState:0];
            self.btn1.titleLabel.font = BoldFontOfSize(14);
            
            self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn2 setBackgroundColor:HexColor(0xffffff)];
            [self.btn2 setTitle:@"查看二维码" forState:0];
            [self.btn2 setTitleColor:Color_ThemeColor forState:0];
            self.btn2.titleLabel.font = BoldFontOfSize(14);
            
            self.btn3.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line3.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn3 setBackgroundColor:Color_ThemeColor];
            [self.btn3 setTitle:@"查看轨迹" forState:0];
            [self.btn3 setTitleColor:HexColor(0xffffff) forState:0];
            self.btn3.titleLabel.font = BoldFontOfSize(14);
            self.btn3.layer.cornerRadius = btnH * 0.5;
            self.btn3.userInteractionEnabled = YES;
        }else {
            //完成
            self.line2.frame = CGRectMake((self.bgView.nim_width - 1) * 0.5, self.line1.nim_bottom, 1, 42);
            self.line3.frame = CGRectZero;
            
            self.btn1.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn1 setBackgroundColor:HexColor(0xffffff)];
            [self.btn1 setTitle:@"详情" forState:0];
            [self.btn1 setTitleColor:Color_ThemeColor forState:0];
            self.btn1.titleLabel.font = BoldFontOfSize(14);
            
            self.btn2.frame = CGRectMake((self.line2.nim_left - btn2W) * 0.5 + self.line2.nim_right, self.line1.nim_bottom + 6, btn2W, btnH);
            [self.btn2 setBackgroundColor:HexColor(0xffffff)];
            [self.btn2 setTitle:@"查看二维码" forState:0];
            [self.btn2 setTitleColor:Color_ThemeColor forState:0];
            self.btn2.titleLabel.font = BoldFontOfSize(14);
            
            self.btn3.frame = CGRectZero;
        }
    }
    self.bgView.nim_height = self.line2.nim_bottom;
    self.height = self.bgView.nim_bottom;
    
}

- (void)btn2Click {
    if (self.model.billStatus) {
        //完成（调度）-查看二维码
        if (self.codeBlock) {
            self.codeBlock();
        }
    }else {
        if (self.model.s_status == 1) {
            //受理-驳回
            if (self.boHuiBlock) {
                self.boHuiBlock();
            }
        }else if (self.model.s_status == 2) {
            //驳回-供应商驳回
            if (self.supplierBoHuiBlock) {
                self.supplierBoHuiBlock();
            }
        }else if (self.model.s_status == 3) {
            //收货-查看二维码
            if (self.codeBlock) {
                self.codeBlock();
            }
        }else if (self.model.s_status == 4) {
            //调度
            if (self.model.is_d_reject == 1) {
                //-司机驳回
                if (self.driverBoHuiBlock) {
                    self.driverBoHuiBlock();
                }
            }else {
                //-查看二维码
                if (self.codeBlock) {
                    self.codeBlock();
                }
            }
        }else if (self.model.s_status == 5) {
            //途中-查看二维码
            if (self.codeBlock) {
                self.codeBlock();
            }
        }else {
            //完成（调度）-查看二维码
            if (self.codeBlock) {
                self.codeBlock();
            }
        }
    }
}

- (void)btn3Click {
    if (self.model.s_status == 1) {
        //受理-受理
        if (self.shouLiBlock) {
            self.shouLiBlock();
        }
    }else if (self.model.s_status == 3) {
        //收货-收货
        if (self.shouHuoBlock) {
            self.shouHuoBlock();
        }
    }else if (self.model.s_status == 4) {
        //调度-调度
        if (self.diaoDuBlock) {
            self.diaoDuBlock();
        }
    }else if (self.model.s_status == 5) {
        //途中-查看轨迹
        if (self.guiJiBlock) {
            self.guiJiBlock();
        }
    }
}

- (void)detailClick {
    if (self.detailBlock) {
        self.detailBlock();
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
